Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip files which were uploaded completely, but the server did not return any response #372

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dobatymo
Copy link
Contributor

@Dobatymo Dobatymo commented Sep 15, 2020

In some cases the server closes the connection after the file was fully uploaded without sending a response. See my comment here #341 (comment)

This doesn't fix the issue of OP, but makes batch uploading of a large number of files easier. I am only handling the RemoteDisconnected exception, which is only raised when the client tries to read the http status line after sending the request.

In my testing the files were always uploaded completely in that case. So rerunning the batch upload with skipping with checksums enabled, it would skip these 'failed' failes correctly. So in case this error is encountered, it will show a informative message and continue with the next file instead of raising the exception and stopping the batch upload.

@Dobatymo Dobatymo force-pushed the retry-remote-disconnect branch from 5225be8 to 2469d6d Compare September 15, 2020 08:42
@Dobatymo
Copy link
Contributor Author

It seems flake8 fails because the upload_item function is "too complex".
Also the exception BadStatusLine used for Python2 is slightly more broad than RemoteDisconnected but should be ok.

@Dobatymo Dobatymo force-pushed the retry-remote-disconnect branch from 2469d6d to b33c908 Compare September 21, 2020 00:03
@Dobatymo Dobatymo force-pushed the retry-remote-disconnect branch from b33c908 to 148e6f5 Compare November 13, 2020 10:17
@Dobatymo Dobatymo force-pushed the retry-remote-disconnect branch from 148e6f5 to 4f11916 Compare November 27, 2020 07:00
@Dobatymo Dobatymo force-pushed the retry-remote-disconnect branch from 4f11916 to c60e581 Compare March 15, 2021 00:49
@Dobatymo Dobatymo force-pushed the retry-remote-disconnect branch from c60e581 to 875d9b3 Compare May 4, 2021 03:12
@Dobatymo Dobatymo force-pushed the retry-remote-disconnect branch from 875d9b3 to a124614 Compare August 5, 2021 02:43
@Dobatymo
Copy link
Contributor Author

Dobatymo commented Aug 5, 2021

Do you want to have another look at this PR? I have been using this patch for a year now and it improves uploading of large batches significantly for me. See the comments in the issue linked above for some people who suffer the same issues.

The code doesn't do anything complex. Just some fine-grained exception handling to ignore some errors (raised incorrectly) by the server.

@jjjake
Copy link
Owner

jjjake commented Aug 9, 2021

I'm not certain I like this as the default, but I think it could be handy as an option. I think it's important to raise an exception (or have a non-zero exit status code), if there's a chance the upload wasn't successful. What are your thoughts on that @Dobatymo?

@Dobatymo
Copy link
Contributor Author

Dobatymo commented Aug 10, 2021

@jjjake I think raising an exception is not the way to go. This error is extremely common for me when uploading batches of large files. Sometimes every file encounters this error, but I have yet to find a file where this error occured and it was not actually fully uploaded. That's why I think retrying is not good also.

Of course I could return another exit code if this error was encountered for any of the files in the batch.

@Dobatymo Dobatymo force-pushed the retry-remote-disconnect branch from a124614 to 95508c9 Compare September 28, 2021 01:02
@Dobatymo Dobatymo force-pushed the retry-remote-disconnect branch from 95508c9 to b0965c0 Compare March 14, 2022 08:27
@Dobatymo Dobatymo force-pushed the retry-remote-disconnect branch from b0965c0 to 51625eb Compare March 28, 2022 01:58
@soredake
Copy link

What's the status of this?

@Dobatymo
Copy link
Contributor Author

@soredake The patch was working well 2-3 years ago. I haven't tested recently. New versions of requests or urllib3 might have changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants